﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kokomo.Lexical.Expressions;

namespace Kokomo.PeInspector.Reflection.Disassembly
{
	class MsilBlock
	{
		public int StartOffset { get; private set; }
		public List<MsilTransition> EntryTransitions { get; private set; }
		public List<MsilTransition> ExitTransitions { get; private set; }
		public Stack<Expression> ExpressionStack { get; private set; }
		public int EndOffset { get; set; }

		public MsilBlock(
			int startOffset
			)
		{
			this.StartOffset = startOffset;
			this.EntryTransitions = new List<MsilTransition>();
			this.ExitTransitions = new List<MsilTransition>();
			this.ExpressionStack = new Stack<Expression>();
			this.StatementFrames = new List<StatementFrameInfo>();
		}

		public List<StatementFrameInfo> StatementFrames { get; set; }

		public override string ToString()
		{
			return string.Format("Start = 0x{0:X4}", this.StartOffset);
		}
	}
}
